// pages/collect/index.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    collect:[],
    tabList: [
      {
        id: 0,
        value: "商品收藏",
        active:true
      },
      {
        id: 1,
        value: "品牌收藏",
        active:false
      },
      {
        id: 2,
        value: "店铺收藏",
        active:false
      },
      {
        id: 3,
        value: "浏览足迹",
        active:false
      }
    ]
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onShow(){
    const collect=wx.getStorageSync("collect")||[];
    this.setData({
      collect
    });
      
  },
  // tab栏点击事件
  handleTabChange(e){
    const index = e.detail;
    let tabs = this.data.tabList;
    tabs.forEach((v,i) => i===index?v.active = true:v.active=false
    )
    this.setData({
      tabList:tabs
    }) 
  }

  
})